import { request } from '@/utils'

// 获取菜单树关系
export function getMenuTree() {
  return request({
    url: 'menu/tree',
    method: 'get',
  })
}

// 获取菜单列表
export function getMenus(query) {
  return request({
    url: 'menu',
    method: 'get',
    params: query,
  })
}

// 获取角色详情
export function getMenuInfo(permissionId, data) {
  return request({
    url: `menu/${permissionId}`,
    method: 'get',
    data,
  })
}

export function addMenu(data) {
  return request({
    url: 'menu',
    method: 'post',
    data,
  })
}

export function editMenu(data) {
  return request({
    url: `menu`,
    method: 'put',
    data,
  })
}

export function deleteMenu(permissionId) {
  return request({
    url: `menu/${permissionId}`,
    method: 'delete',
    data: { permissionId },
  })
}
